#ifndef CONTROLLER_H
#define CONTROLLER_H

#include "book.h"
#include "person.h"

// includes
#include "personrepository.h"
#include "bookrepository.h"

#include <QVector>

class Controller
{
public:
	explicit Controller( const BookRepository &bookRepository,
	                     const PersonRepository &personRepository );

	void updateDataBase();
	void addBook( const Book &book );
	void addPerson( const Person &person );
	void removeBook( const Book &book );
	void removeBook( const ID &id );
	void removePerson( const Person &person );
	void removePerson( const ID &id );
	void borrowBook( const Book &book, const Person &person );
	void borrowBook( const ID &bookId, const ID &personId );
	void returnBook( const Book &book, const Person &person );
	void returnBook( const ID &bookId, const ID &personId );
	BookRepository getBookRepository();
	PersonRepository getPersonRepository();

private:
	BookRepository m_bookRepository;
	PersonRepository m_personRepository;

	QVector<Person> m_personList;
	QVector<Book> m_bookList;
};

#endif // CONTROLLER_H
